using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline.Processors;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using Oops.Xna.Framework.Physics;

namespace Oops.Xna.Framework.Content.Pipeline.Serialization.Compiler
{
	[ContentTypeWriter()]
	public class CollisionGroupCollectionWriter : ContentTypeWriter<CollisionSystem.CollisionGroupCollection>
	{
		#region ContentTypeWriter<CollisionSystem.CollisionGroupCollection> Members

		public override bool CanDeserializeIntoExistingObject
		{
			get { return true; }
		}

		protected override void Write(ContentWriter output, CollisionSystem.CollisionGroupCollection value)
		{
			output.Write(value.Count);
			foreach (var group in value)
			{
				output.WriteSharedResource(group);
			}
		}

		public override string GetRuntimeReader(TargetPlatform targetPlatform)
		{
			return "Oops.Xna.Framework.Physics.CollisionGroupCollectionReader, Oops.Xna.Framework";
		}

		#endregion
	}
}
